<template>
  <div class="numdiv">
    <el-row class="eldiv1">
      <el-col :span="24">
        <el-input
          type="number"
          v-model="mulrenum.rnuRadioContent"
          :placeholder="setPlaceholder()"
          v-on:input="getChangeStringValue()"
        >
          <template slot="prepend">{{tableSetJson.label}}</template>
        </el-input>
      </el-col>
    </el-row>
    <el-row style="margin-bottom: 3px">
      <el-col :span="24">
        <el-input
                disabled
                type="text"
                v-model="tableSetJson.labeltip"
        >
          <template slot="prepend">设计要求：</template>
        </el-input>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "numinput",
  props: {
    /* 父组件传过来的数据 */
    tableSetJson: {
      type: Object
    },
    renumin: {
      type: Object
    }
  },
  watch: {
    mulrenum:{
      handler(newVal, oldVal) {
        this.$emit("listenToDateInput", newVal);
      }
    }
  },
  data() {
    return {
      mulrenum: this.renumin
    };
  },
  activated() {
    //console.log("============>>>>>>" + JSON.stringify(this.mulrenum.rnuRadioContent));
  },
  methods: {
    /* 往父节点传值的方法 */
    getChangeStringValue() {
      this.mulrenum.rnuCode = this.tableSetJson.name;
      this.mulrenum.rnuType = this.tableSetJson.type;   
      this.mulrenum.rnuNo = this.tableSetJson.orderno;
      //console.log("tableSetJson============>>>>>>" + JSON.stringify(this.tableSetJson));
      //console.log("输出本框输出的对象为：======>>>>>" + JSON.stringify(this.mulrenum));
      /* 子组件主动发送数据给父组件 */
      this.$emit("listenToNumInput", this.mulrenum);
    },
    setPlaceholder() {
      return this.tableSetJson.texttip;
    }
  }
};
</script>
<style>
.numdiv {
  width: 724px;
  margin-left: 5px;
  margin-top: 5px;
  margin-bottom: 5px;
  background-color: #f3f3f3;
}
</style>


